/*
 * FileName：AccountFans.java 
 * <p>
 * Copyright (c) 2017-2020, <a href="http://www.webcsn.com">hermit (794890569@qq.com)</a>.
 * <p>
 * Licensed under the GNU General Public License, Version 3 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.gnu.org/licenses/gpl-3.0.html
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package com.wxmp.wxcms.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.wxmp.core.page.Page;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;

import javax.persistence.Transient;

/**
 *
 * @author hermit
 * @version 2.0
 * @date 2018-04-17 10:54:58
 */
public class AccountFans extends Page implements Serializable {
    private Long id;
    
    private String openId;// openId，每个用户都是唯一的
    
    private Integer subscribeStatus;// 订阅状态
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME)
    private Date subscribeTime;// 订阅时间
    
    private byte[] nickName;// 昵称,二进制保存emoji表情
    @Transient
    private String nickNameStr;// 昵称显示
    
    private String wxid;// 微信号
    
    private Integer gender;// 性别 0-女；1-男；2-未知
    
    private String language;// 语言
    
    private String country;// 国家
    
    private String province;// 省
    
    private String city;// 城市
    
    private String headImgUrl;// 头像
    
    private String remark;// 备注
    
    private Integer status;// 用户状态 1-可用；0-不可用
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss", iso = DateTimeFormat.ISO.DATE_TIME)
    private Date createTime;// 创建时间
    
    public String getNicknameStr() {
        if (this.getNickName()!=null ) {
            try {
                this.nickNameStr = new String(this.getNickName(),"UTF-8");
            }
            catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
        return nickNameStr;
    }
    
    public Long getId() {
        return id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    public String getOpenId() {
        return openId;
    }
    
    public void setOpenId(String openId) {
        this.openId = openId;
    }
    
    public Integer getSubscribeStatus() {
        return subscribeStatus;
    }
    
    public void setSubscribeStatus(Integer subscribeStatus) {
        this.subscribeStatus = subscribeStatus;
    }
    
    public Date getSubscribeTime() {
        return subscribeTime;
    }
    
    public void setSubscribeTime(Date subscribeTime) {
        this.subscribeTime = subscribeTime;
    }
    
    
    public String getWxid() {
        return wxid;
    }
    
    public void setWxid(String wxid) {
        this.wxid = wxid;
    }
    
    public Integer getGender() {
        return gender;
    }
    
    public void setGender(Integer gender) {
        this.gender = gender;
    }
    
    public String getLanguage() {
        return language;
    }
    
    public void setLanguage(String language) {
        this.language = language;
    }
    
    public String getCountry() {
        return country;
    }
    
    public void setCountry(String country) {
        this.country = country;
    }
    
    public String getProvince() {
        return province;
    }
    
    public void setProvince(String province) {
        this.province = province;
    }
    
    public String getCity() {
        return city;
    }
    
    public void setCity(String city) {
        this.city = city;
    }
    
    
    
    /**
     * 获取 headImgUrl
     * @return 返回 headImgUrl
     */
    public String getHeadImgUrl() {
        return headImgUrl;
    }

    /**
     * 设置 headImgUrl
     * @param 对headImgUrl进行赋值
     */
    public void setHeadImgUrl(String headImgUrl) {
        this.headImgUrl = headImgUrl;
    }

    public String getRemark() {
        return remark;
    }
    
    public void setRemark(String remark) {
        this.remark = remark;
    }
    
    public Integer getStatus() {
        return status;
    }
    
    public void setStatus(Integer status) {
        this.status = status;
    }
    
    public Date getCreateTime() {
        return createTime;
    }
    
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    
    public void setNicknameStr(String nicknameStr) {
        this.nickNameStr = nicknameStr;
    }

    /**
     * 获取 nickName
     * @return 返回 nickName
     */
    public byte[] getNickName() {
        return nickName;
    }

    /**
     * 设置 nickName
     * @param 对nickName进行赋值
     */
    public void setNickName(byte[] nickName) {
        this.nickName = nickName;
    }
    
}
